package tests;

import common.UtilsMatch;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;

public class Match extends UtilsMatch {
    public static final String str1="http://127.0.0.1:8080/login.html";
    public static final String str2="http://127.0.0.1:8080/login.html";
    public Match() {
        super(str1, str2);
    }
    public void login() throws InterruptedException {
        driverChrome.findElement(By.cssSelector("#username")).clear();
        driverChrome.findElement(By.cssSelector("#password")).clear();
        driverChrome.findElement(By.cssSelector("#username")).sendKeys("hanmeimei1");
        driverChrome.findElement(By.cssSelector("#password")).sendKeys("123456789");
        driverChrome.findElement(By.cssSelector("#submit")).click();
        Thread.sleep(1000);
        Alert alert=driverChrome.switchTo().alert();
        alert.accept();

        driverEdge.findElement(By.cssSelector("#username")).clear();
        driverEdge.findElement(By.cssSelector("#password")).clear();
        driverEdge.findElement(By.cssSelector("#username")).sendKeys("baijiang123");
        driverEdge.findElement(By.cssSelector("#password")).sendKeys("123456789");
        driverEdge.findElement(By.cssSelector("#submit")).click();
        Thread.sleep(1000);
        alert=driverEdge.switchTo().alert();
        alert.accept();
    }
    public void matchPlayer(){
        driverChrome.findElement(By.cssSelector("#match-button")).click();
        driverEdge.findElement(By.cssSelector("#match-button")).click();
    }
}
